//
// Created by konglinglong on 2020/9/26.
//

#include <stdarg.h>
#include "../../../../lib/csp/include/cspApi.h"
#include "../../include/commDef.h"
#include "../include/misc.h"

int32_t O5G_GetAppType(const char* appTypeStr)
{
    uint32_t loop;

    for (loop = 0; loop < APP_TYPE_BUTT; loop++)
    {
        if (0 == strcmp(appTypeStr, gAppTypeStrTable[loop]))
        {
            return loop;
        }
    }
    return APP_TYPE_BUTT;
}

void O5G_FSM_Print(uint32_t type, const char *fmt, ...)
{
    va_list vl;
    uint32_t logLvl;
    char log_buffer[512];

    va_start(vl, fmt);
    vsnprintf(log_buffer, sizeof(log_buffer), fmt, vl);
    va_end(vl);

    logLvl = (FSM_LOG_TYPE_ERR == type) ? LOG_LVL_ERR : LOG_LVL_INF;

    CSP_LOG_SYNC(0, logLvl, "%s", (char *)log_buffer);
}
